﻿namespace Leetcode.N0908;
public class Solution
{
    public int SmallestRangeI(int[] nums, int k)
    {
        int min = nums[0];
        int max = nums[0];
        for (int i = 1; i < nums.Length; i++)
        {
            min = Math.Min(min, nums[i]);
            max = Math.Max(max, nums[i]);
        }
        return Math.Max(0, (max - min) - k * 2);
    }
}